<script setup>
import { ref } from 'vue';
import Bottom from '@/components/bottom/index.vue'
import { copyText, showToast } from '@/public';
import { https } from '@/api/api';
import { onLoad } from '@dcloudio/uni-app';
import Tabbar from '@/components/tabbar/index.vue'
// 变量
// 表单列表
const content = ref('');

const statusBottomHeight = ref(0);
uni.getSystemInfo({
    success: function (info) {
        // 获取安全区域的 bottom 值，单位px
        let safeBottom = info.safeAreaInsets.bottom;
        statusBottomHeight.value = uni.upx2px(100) + safeBottom;
    }
});
/**
 * @property  所有请求以api开头 如:apiDataInfo
 * */
const apiFromList = async () => {
    const res = await https({
        mode: 'public',
        name: 'apiGetDayStatistics'
    });
    if (res.code !== 0) return showToast(res.msg);
    content.value = res.data.content
}

/**
 * @property 自定义事件 以事件名开头 如: clickButton,inputDev
 */
const clickCopyText = () => {

    copyText(content.value)
}

/**
 * @property vue内置方法
 */
onLoad(() => {
    apiFromList();
})
</script>
<template>
    <div class="w-[100vw] h-[100vh] bg-[#f2f2f2] p-3.5 flex flex-col">
        <up-empty mode="data" v-if="formlist === ''" text="今日还未添加任何数据" />
        <div class="bg-[#fff] b-rd-2 p-3.5 flex-1 relative flex flex-col overflow-hidden">
            <div class="flex-1 overflow-hidden">
                <scroll-view scroll-y class="w-[100%] h-[100%]">
                    <text>{{ content }}</text>
                </scroll-view>
            </div>
            <div class="absolute bottom-24 w-[100%] h-88rpx pl-3 pr-3 ml--3">
                <Bottom text="复制" @click="clickCopyText" />
            </div>
            <div class="h-88">

            </div>
        </div>
        <div :style="{
            height: statusBottomHeight + 'px'
        }">

        </div>
    </div>
    <Tabbar type="order" />
</template>
<style lang="scss" scoped></style>